from tortoise import fields
from datetime import datetime
from .base import BaseModel, TimestampMixin


class SysDictData(BaseModel, TimestampMixin):
    """字典数据表"""

    dict_code = fields.IntField(pk=True, description="字典编码")

    dict_sort = fields.IntField(null=True, description="字典排序")

    dict_label = fields.CharField(max_length=100, null=True, description="字典标签")

    dict_value = fields.CharField(max_length=100, null=True, description="字典键值")

    dict_type = fields.CharField(max_length=100, null=True, description="字典类型")

    css_class = fields.CharField(max_length=100, null=True, description="样式属性（其他样式扩展）")

    list_class = fields.CharField(max_length=100, null=True, description="表格回显样式")

    is_default = fields.CharField(max_length=1, null=True, description="是否默认（Y是 N否）")

    status = fields.CharField(max_length=1, null=True, description="状态（0正常 2删除）")

    create_by = fields.CharField(max_length=64, null=True, description="创建者")

    create_time = fields.DatetimeField(null=True, description="创建时间")

    update_by = fields.CharField(max_length=64, null=True, description="更新者")

    update_time = fields.DatetimeField(null=True, description="更新时间")

    remark = fields.CharField(max_length=500, null=True, description="备注")

    class Meta:
        table = "sys_dict_data"

    def __str__(self):
        return f"{self.dict_code}"